<!--
*******************************************************************************
 * Copyright © 2021-2022 VMware, Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 *
 * @author: Huaqiao Zhang, <huaqiaoz@vmware.com>
 *******************************************************************************
 -->

 <div class="card">
     <div class="card-header font-weight-bold">
        <i class="fa fa-list mr-2 text-danger"></i>
        <span i18n>Device Service List</span>
     </div>
     <div class="card-body p-0">
        <div class="table-responsive">
            <table class="table table-hover text-truncate">
                <thead class="thead-light">
                    <tr>
                        <th scope="col">#</th>
                        <th scope="col" i18n>ID</th>
                        <th scope="col" i18n>Name</th>
                        <th scope="col" i18n>Description</th>
                        <th scope="col" i18n>Labels</th>
                        <th scope="col" i18n>AdminState</th>
                        <!-- <th scope="col">OperatingState</th> -->
                        <th scope="col" i18n>Created</th>
                        <th scope="col" i18n>Modified</th>
                    </tr>
                </thead>
                <tbody>
                    <tr *ngFor="let svc of deviceServiceList" [class.table-active]="isSvcChecked(svc.name)">
                        <td><input type="checkbox" role="button" [checked]="isSvcChecked(svc.name)" (click)="selectOneSvc($event,svc.name)"></td>
                        <td>{{svc.id}}</td>
                        <td>{{svc.name}}</td>
                        <td>{{svc.description}}</td>
                        <td>{{svc.labels}}</td>
                        <td>{{svc.adminState}}</td>
                        <!-- <td>{{svc.operatingState}}</td> -->
                        <td>{{svc.created | date:'yyyy-MM-dd hh:mm:ss'}}</td>
                        <td>{{svc.modified | date:'yyyy-MM-dd hh:mm:ss'}}</td>
                    </tr>
                </tbody>
            </table>
        </div>
     </div>
     <div class="card-footer text-muted p-1">
        <nav aria-label="navigation">
            <ul class="pagination justify-content-end m-0">
                <li class="page-item mr-2 mt-1">
                    <span class="align-middle" i18n>items per page</span>
                </li>
                <li class="page-item mr-2 ">
                    <select class="custom-select" name="pageLimit" id="pageLimit" [(ngModel)]="pageLimit" (ngModelChange)="onPageSelected()">
                        <option value="5">5</option>
                        <option value="10">10</option>
                        <option value="20">20</option>
                    </select>
                </li>
                <li class="page-item mr-1">
                    <button class="page-link btn" (click)="prePage()" [disabled]="pagination === 1">
                        <i class="fa fa-angle-double-left mr-1"></i> 
                        <span i18n>Previous</span>
                    </button>
                </li>
                <li class="page-item" >
                    <button class="page-link btn" (click)="nextPage()" [disabled]="this.pageLimit > deviceServiceList.length">
                        <span i18n>Next</span>
                        <i class="fa fa-angle-double-right ml-1"></i>
                    </button>
                </li>
            </ul>
        </nav>
     </div>
 </div>